<?php

namespace LhpAmis\Renderers;

/**
 * 图片展示控件。 文档：https://aisuda.bce.baidu.com/amis/zh-CN/components/image
 *
 * @author  slowlyo
 * @version 6.7.0
 */
class ServiceImag extends Service
{
    protected $image = null;

    public function __construct()
    {
        $this->set('type', 'service');

        $this->image('src', '${url}');
    }
    public function image($name, $value)
    {
        if ($this->image == null) {
            $this->image = Image::make();
            $this->image->set('height', '30px');
            $this->image->set('enlargeAble', true);
        }
        if ($name !== '') {
            $this->image->set($name, $value);
        }

        $this->body($this->image);
        return $this;
    }
}
